package com.wwz.leetcode;

import org.junit.Test;

public class LeetCode58 {
    public static void main(String[] args) {
        String s = "   fly me   to   the moon  ";
        String a = "///a/b//c///d";
        String[] s1 = a.split("/");
        System.out.println(s1);
        test2(s);
    }
    @Test
    public static void test(String s){
        String trim = s.trim();
        int length = trim.length();
        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < length; i++) {

            if(" ".equals(String.valueOf(trim.charAt(length-i-1)))){
                break;
            }
            sb.append(trim.charAt(length-i-1));

        }

    }
    @Test
    public static void test2(String s){
        String[] split = s.split(" ");
        System.out.println(split[split.length-1].length());
        //return split[split.length-1].length();
    }
}
